<template>
	<view class="item-container">
		<view class="left">
			<view class="icon">
				<image :src="icon" class="img"></image>
			</view>
			<view class="content">
				<view class="title">{{ title }}</view>
				<view class="desc">{{desc}}</view>
			</view>
		</view>
		<view v-if="btnText" class="btn" @click="handleClick">
			{{btnText}}
		</view>
	</view>
</template>

<script>
	export default {
		name: 'advice',
		props: {
			icon: {
				type: String,
				require: true
			},
			title: {
				type: String,
				default: ''
			},
			desc: {
				type: String,
				default: ''
			},
			btnText: {
				type: String,
				default: null
			},
			productId: {
				type: Number,
				default: null
			}
		},
		methods: {
			handleClick() {
				this.$tab.navigateTo('/pages/home/invite?id=' + (this.productId ? this.productId : 0))
			}
		}
	}
</script>

<style scoped lang="scss">
	.item-container {
		display: flex;
		align-items: center;
		height: 72rpx;
		justify-content: space-between;
		padding-right: 32rpx;
		box-sizing: border-box;
		margin-bottom: 40rpx;

		.left {
			display: flex;
			height: 72rpx;
			align-items: center;

			.icon {
				width: 72rpx;
				height: 72rpx;

				.img {
					width: 72rpx;
					height: 72rpx;
				}
			}

			.content {
				height: 72rpx;
				margin-left: 24rpx;

				.title {

					color: #252C32;
					font-family: PingFang SC, PingFang SC;
					font-weight: 600;
					font-size: 28rpx;
				}

				.desc {
					color: #48535B;
					font-size: 22rpx;
				}
			}
		}

		.btn {
			width: 132rpx;
			height: 48rpx;
			border-radius: 42rpx;
			background: linear-gradient(292deg, #D8E4FF 0%, #D0DDFF 100%);
			color: #09267C;
			font-size: 24rpx;
			display: flex;
			justify-content: center;
			align-items: center;

			&-disabled {
				width: 132rpx;
				height: 48rpx;
				border-radius: 42rpx;
				font-size: 24rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				background-color: #F3F4F6 !important;
				color: #6E7C87 !important;
			}
		}
	}
</style>